<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        {{msg}}
        <p v-text='msg2'>我是v-html 可以渲染标签</p>

        <form action="">
            用户名：<input type="text" name="" id="" v-model='user'>===={{user}}===</br>
            密码：<input type="text" name="" id="" v-model='pwd'>====={{pwd}}=====</br>
            <input type="submit" @click.prevent='btn'>
        </form>

        <div :class='[active,"active2"]'>
            方法1：数组添加类名 aa active2
        </div>

        <div :class='[flag?active:"","active2"]'>
            方法2：数组添加类名 三元表达式 aa active2
        </div>

        <div :class='[active,{active2:flag}]'>
            方法3：数组添加类名 aa active2
        </div>

        <div :class='{aa:flag,active:flag2}'>
            方法4：对象添加类名 aa
        </div>

        <div :style="{color:red,fontSize:'20px'}">
            行内样式绑定属性
        </div>

        <div :style="obj">
            行内样式绑定属性===3333333
        </div>

        <div :style="arrobj">
            数组类型 行内样式绑定属性===3333333
        </div>

        <div :style="[{ color: 'red', fontSize: '20px' }]">
            数组类型 行内样式绑定属性===55555
        </div>


        <div :style="[{ color: 'red' },{ fontSize: '20px' }]">
            数组类型 行内样式绑定属性===66666
        </div>

    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 1111,
                msg2: '<span>222222</span>',
                user: 'admin',
                pwd: 111,
                active: 'aa',
                active2: 'bb',
                flag: true,
                flag2: false,

                qq: 'color: red;',
                red: 'blue',
                obj: { color: 'red', fontSize: '20px' },
                arrobj: [
                    { color: 'red', fontSize: '20px' }
                ]
            },
            methods: {
                btn() {
                    console.log(this.user, this.pwd);
                }
            }
        })
    </script>
</body>

</html>